feat(novita): build Vidu subjects from image_urls when not supplied#18
Merged
Conversation
`vidu-q2-reference2video` and `viduq2-pro-fast` are the only Vidu shapes that
take reference images as `subjects` (`[{id, images}]`, addressed from the prompt
as `@1`, `@2`) rather than a flat `images` array. Everything upstream of the
gateway speaks `image_urls`: the playground only renders its upload control for
a model whose schema declares `image_urls`, and RouterBase's base64
materialisation and URL pre-check both key on that field. The result was that
these two models had no way to supply a reference image from the UI at all, and
no base64 support via the API.
Accept `image_urls` for the subject shape too, fanning each URL out into its own
subject in order, so `@N` addresses the Nth image. An explicit `subjects` still
wins, keeping the richer form (several angles of one subject, `voice_id`)
reachable for callers that need it.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
I have read the Contributor License Agreement (CLA) and hereby sign the CLA. You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
vidu-q2-reference2videoandviduq2-pro-fastare the only two Vidu shapes that take reference images assubjectsrather than a flatimagesarray. Everything upstream of the gateway speaksimage_urls:image_urls;Net effect: these two models had no way to supply a reference image from the UI at all, and no base64 support via the API. Callers had to hand-write a
subjectsarray and self-host the images.Change
Accept
image_urlsfor the subject shape too, fanning each URL out into its own subject, in order, so@Naddresses the Nth image. An explicitsubjectsstill wins, keeping the richer form (several images of one subject,voice_id) reachable.Getting the shape right
The enum's doc comment claimed
{id|name, images, voice_id}and the existing passthrough test asserted{"id": "@1", …}— both were wrong. That test only checks the blob is forwarded verbatim, so it never exercised the payload against Novita and never caught it.A live call returned Novita's actual schema:
So the key is
name, andnameis the bare reference —@1meansname: "1", not"@1". Corrected the code, the stale doc comment, and the two tests that encoded the wrong shape.Verification
vidu_build_body_testspass, including two new ones (fan-out; explicit-subjects-wins).cargo fmt+clippyclean (the onecollapsible_ifmatches the pre-existingimagesblock directly above).vidu/q2-pro-fastwithimage_urls→ accepted, rendered, MP4 returned. The pre-fix payload was rejected with the 400 quoted above.🤖 Generated with Claude Code